package com.spring_mysql_redis.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spring_mysql_redis.entity.Dynamic;
import com.spring_mysql_redis.entity.Friend;
import com.spring_mysql_redis.entity.UserDynamic;
import com.spring_mysql_redis.entity.Users;
import com.spring_mysql_redis.model.ResultFormatPaging;
import com.spring_mysql_redis.service.FriendService;
import com.spring_mysql_redis.utils.ResultPagingUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "好友管理")
@RestController
@RequestMapping("/friends")
public class FriendController {

    private Logger logger = LoggerFactory.getLogger(FriendController.class);

    @Autowired
    private FriendService friendService;

    /**
     * 查询好友列表信息
     *
     * @return
     */
    @ApiOperation("查询好友列表接口")
    @GetMapping("/list")
    public Page<Users> pgUserDynamicsList(@RequestParam("page") Integer page, @RequestParam("limit") Integer limit, @RequestParam("uuId") String uuId) {
        logger.info("-------------------进入好友列表查询controller层--------------------------");
        Page<Users> iPage = new Page<Users>(page, limit);
        return friendService.selectFriendList(iPage, uuId);

    }
}
